load("//tools/lint:lint.bzl", "add_lint_tests")
load(
    "//tools/skylark:drake_cc.bzl",
    "drake_cc_googletest",
    "drake_cc_library",
    "drake_cc_package_library",
)

package(default_visibility = ["//visibility:public"])

drake_cc_package_library(
    name = "test_utilities",
    testonly = 1,
    visibility = ["//visibility:public"],
    deps = [
        ":controlled_spring_mass_system",
        ":cubic_scalar_system",
        ":discontinuous_spring_mass_damper_system",
        ":explicit_error_controlled_integrator_test",
        ":generic_integrator_test",
        ":implicit_integrator_test",
        ":linear_scalar_system",
        ":logistic_system",
        ":my_spring_mass_system",
        ":pleides_system",
        ":quadratic_scalar_system",
        ":quartic_scalar_system",
        ":quintic_scalar_system",
        ":robertson_system",
        ":spring_mass_damper_system",
        ":spring_mass_system",
        ":stateless_system",
        ":stationary_system",
        ":stiff_double_mass_spring_system",
    ],
)

drake_cc_library(
    name = "controlled_spring_mass_system",
    testonly = 1,
    srcs = ["controlled_spring_mass_system.cc"],
    hdrs = ["controlled_spring_mass_system.h"],
    deps = [
        ":spring_mass_system",
        "//systems/controllers:pid_controller",
        "//systems/framework",
        "//systems/primitives:adder",
        "//systems/primitives:constant_vector_source",
        "//systems/primitives:demultiplexer",
        "//systems/primitives:gain",
        "//systems/primitives:multiplexer",
    ],
)

drake_cc_library(
    name = "cubic_scalar_system",
    testonly = 1,
    hdrs = ["cubic_scalar_system.h"],
    deps = [
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "discontinuous_spring_mass_damper_system",
    testonly = 1,
    hdrs = ["discontinuous_spring_mass_damper_system.h"],
    deps = [
        ":spring_mass_damper_system",
    ],
)

drake_cc_library(
    name = "explicit_error_controlled_integrator_test",
    testonly = 1,
    hdrs = ["explicit_error_controlled_integrator_test.h"],
    deps = [
        ":my_spring_mass_system",
        "//common/test_utilities:expect_no_throw",
    ],
)

drake_cc_library(
    name = "generic_integrator_test",
    testonly = 1,
    hdrs = ["generic_integrator_test.h"],
    deps = [
        "//multibody/plant",
    ],
)

drake_cc_library(
    name = "implicit_integrator_test",
    testonly = 1,
    hdrs = ["implicit_integrator_test.h"],
    deps = [
        ":discontinuous_spring_mass_damper_system",
        ":linear_scalar_system",
        ":my_spring_mass_system",
        ":robertson_system",
        ":stationary_system",
        ":stiff_double_mass_spring_system",
        "//common/test_utilities:expect_no_throw",
    ],
)

drake_cc_library(
    name = "linear_scalar_system",
    testonly = 1,
    hdrs = ["linear_scalar_system.h"],
    deps = [
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "logistic_system",
    testonly = 1,
    hdrs = ["logistic_system.h"],
    deps = [
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "my_spring_mass_system",
    testonly = 1,
    hdrs = ["my_spring_mass_system.h"],
    deps = [
        ":spring_mass_system",
    ],
)

drake_cc_library(
    name = "pleides_system",
    testonly = 1,
    hdrs = ["pleides_system.h"],
    deps = [
        "//systems/framework:leaf_system",
    ],
)

drake_cc_library(
    name = "quadratic_scalar_system",
    testonly = 1,
    hdrs = ["quadratic_scalar_system.h"],
    deps = [
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "quartic_scalar_system",
    testonly = 1,
    hdrs = ["quartic_scalar_system.h"],
    deps = [
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "quintic_scalar_system",
    testonly = 1,
    hdrs = ["quintic_scalar_system.h"],
    deps = [
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "robertson_system",
    testonly = 1,
    hdrs = ["robertson_system.h"],
    deps = [],
)

drake_cc_library(
    name = "spring_mass_damper_system",
    testonly = 1,
    hdrs = ["spring_mass_damper_system.h"],
    deps = [
        ":spring_mass_system",
    ],
)

drake_cc_library(
    name = "spring_mass_system",
    testonly = 1,
    srcs = ["spring_mass_system.cc"],
    hdrs = ["spring_mass_system.h"],
    deps = [
        "//systems/framework:leaf_system",
    ],
)

drake_cc_googletest(
    name = "spring_mass_system_test",
    size = "medium",
    deps = [
        ":spring_mass_system",
        "//common/test_utilities",
        "//systems/framework/test_utilities",
    ],
)

drake_cc_library(
    name = "stateless_system",
    testonly = 1,
    hdrs = ["stateless_system.h"],
    deps = [
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "stationary_system",
    testonly = 1,
    srcs = ["stationary_system.cc"],
    hdrs = ["stationary_system.h"],
    deps = [
        "//common:default_scalars",
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "stiff_double_mass_spring_system",
    testonly = 1,
    hdrs = ["stiff_double_mass_spring_system.h"],
    deps = [],
)

drake_cc_googletest(
    name = "controlled_spring_mass_system_test",
    deps = [
        ":controlled_spring_mass_system",
    ],
)

add_lint_tests()
